/* main.c */
#include "app_inc.h"

int main(void)
{
    NRF24L01_Config_T config =
    {
        {0x34, 0x43, 0x10, 0x10, 0x01},
        {0x34, 0x43, 0x10, 0x10, 0x01}
    };
    uint8_t buffer[NRF24L01_XFER_PACKAGE_LENGTH];

    BSP_InitStdioUART(115200U);

    printf("SPI_Nrf24l01Test Example ...\r\n");

    if (NRF24L01_Init(&config))
    {
        printf("NRF24L01 is ready.\r\n");
    }
    else
    {
        printf("NRF24L01 is not detected.\r\n");
    }

    while (1)
    {
        if (NRF24L01_GetRxPackageReadyFlag())
        {
            NRF24L01_GetRxPackage(buffer);
            NRF24L01_ClearRxPackageReadyFlag();
            printf("Rx Done\r\n");
            if (NRF24L01_TxPackage(buffer))
            {
                printf("Tx Done.\r\n");
            }
            else
            {
                printf("Tx Failed.\r\n");
            }
        }
    }
}

/* EOF. */
